package org.example.service;



import org.example.mapper.StudentMapper;
import org.example.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired
    private StudentMapper studentMapper;

    public int addStudent(Student student) {
        return studentMapper.insertStudent(student);
    }

    public int updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    public int deleteStudent(Long id) {
        return studentMapper.deleteStudent(id);
    }

    public Student getStudentById(Long id) {
        return studentMapper.getStudentById(id);
    }

    public List<Student> getAllStudents() {
        return studentMapper.getAllStudents();
    }

    public List<Student> getStudentsByClass(String className) {
        return studentMapper.getStudentsByClass(className);
    }
}